home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / System7 tools / Frontier / Frontier SDK 2.1 / Toolkits / IAC Tools / iacrect.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-09  |  1.5 KB  |  76 lines  |  [TEXT/KAHL]

  1.  
  2. /*© Copyright 1988-1993 UserLand Software, Inc.  All Rights Reserved.*/
  3.  
  4. #include "iacinternal.h"
  5.  
  6.  
  7. #define typeRect 'qdrt'
  8.  
  9.  
  10. Boolean IACpushrectparam (Rect *x, OSType keyword) {
  11.     
  12.     return (IACpushrectitem (IACglobals.event, x, keyword));
  13.     } /*IACpushrectparam*/
  14.  
  15.  
  16. Boolean IACreturnrect (Rect *x) {
  17.     
  18.     return (IACpushrectitem (IACglobals.reply, x, keyDirectObject));
  19.     } /*IACreturnrect*/
  20.  
  21.  
  22. Boolean IACgetrectparam (OSType keyword, Rect *val) {
  23.     
  24.     if (!IACgetrectitem (IACglobals.event, keyword, val)) {
  25.         IACparamerror (IACglobals.errorcode, "\prectangle", keyword);
  26.         
  27.         return (false);
  28.         }
  29.     
  30.     IACglobals.nextparamoptional = false; /*must be reset for each param*/
  31.     
  32.     return (true);
  33.     } /*IACgetrectparam*/
  34.     
  35.     
  36. Boolean IACgetrectitem (AEDescList *list, long n, Rect *val) {
  37.     
  38.     register OSErr ec;
  39.     DescType key;
  40.     DescType typeCode;
  41.     Size actualSize;
  42.     
  43.     if ((*list).descriptorType != typeAEList) {
  44.     
  45.         ec = AEGetKeyPtr (list, n, typeRect, &typeCode, (Ptr) val, sizeof (*val), &actualSize);
  46.  
  47.         if (ec != errAEDescNotFound)
  48.             goto done;
  49.         }
  50.  
  51.     ec = AEGetNthPtr (list, n, typeRect, &key, &typeCode, (Ptr) val, sizeof (*val), &actualSize);
  52.     
  53.     done:
  54.     
  55.     IACglobals.errorcode = ec;
  56.     
  57.     return (ec == noErr);
  58.     } /*IACgetrectitem*/
  59.  
  60.  
  61. Boolean IACpushrectitem (AEDescList *list, Rect *x, long n) {
  62.     
  63.     register OSErr ec;
  64.     
  65.     if ((*list).descriptorType != typeAEList)
  66.         ec = AEPutKeyPtr (list, n, typeRect, (Ptr) x, sizeof (*x));
  67.     else
  68.         ec = AEPutPtr (list, n, typeRect, (Ptr) x, sizeof (*x));
  69.     
  70.     IACglobals.errorcode = ec;
  71.     
  72.     return (ec == noErr);
  73.     } /*IACpushrectitem*/
  74.  
  75.  
  76.